global._args = {}

class Port {
    constructor() {
        global._args.koaport = 3000
    }
    handler(value) {
        global._args.koaport = value
    }
}

// test prod
class Env {
    constructor() {
        global._args.koaEnv = 'test'
    }
    handler(value) {
        global._args.koaEnv = value
    }
}

const aegvListener = {
    '-p': new Port(),
    '-env': new Env(),
}



function argvCollector() {
    process.argv.reduce((prev, curr) => {
        if (prev in aegvListener) {
            try {
                aegvListener[prev].handler(curr)
            } catch (e) {
                // ???
            }
        }
        return curr
    })
}

argvCollector()